// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境

// 云函数入口函数
exports.main = async (event, context) => {
  return cloud.callFunction({
    name: "model_student",
    data: {
      op: "select",
      key: "u_id",
      value: event.user_id
    }
  }).then(res => {
    var institution_ids = [];
    for (var i = 0; i < res.result.data.length; i++) {
      // console.log(res.result[i].i_id);
      institution_ids.push(res.result.data[i].i_id);
    }
    institution_ids = Array.from(new Set(institution_ids));
    console.log(institution_ids);
    return institution_ids;
  })
}